package main.java.hotProd;

import cn.hutool.core.date.DateUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.util.Date;

/**
 * SalesMain
 *
 * @author zhangyimin
 * @version 1.0
 * @date 2018-11-07 上午10:08
 */
public class HotProdDataCleanMain {

    public static void main(String[] args) throws  Exception {
        Job job = Job.getInstance(new Configuration());
        job.setJarByClass(HotProdDataCleanMain.class);

        //2??????????Mapper???????????
        job.setMapperClass(HotProdDataCleanMapper.class);
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(NullWritable.class);

        FileInputFormat.setInputPaths(job, new Path("hdfs://10.16.7.36:9000/flume/**"));
        FileOutputFormat.setOutputPath(job, new Path("hdfs://10.16.7.36:9000/data/output/hot_products/data_clean/out_" + DateUtil.format(new Date(),"yyyyMMddHHmmss")));


        //5?????
        job.waitForCompletion(true);
    }
}
